package com.nginxmanager.controller;

import com.nginxmanager.domain.Conf;
import com.nginxmanager.domain.Model;
import com.nginxmanager.server.ModelRepository;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2018-01-16.
 */
@RestController
@RequestMapping("/nginx")
@Api(tags = "Nginx模块数据库操作Api")
public class ModelSqlController {
    @Autowired
    ModelRepository modelRepository;

    @GetMapping("/getModelSql")
    @ApiOperation("查看数据库中配置模块")
    public ResponseEntity<List<Model>> getbypage (){
        List<Model> models = new ArrayList<>();
        models = modelRepository.findAll();
        return ResponseEntity.status(200).body(models);
    }

}
